#pragma once
/*--------------------------------------------------------------------------------
 * Adaptive Intelligence - Foundation Framework Class Library
 * Version 2.00
 * 
 * DNS Pointer Record Structure
 *      Represents a DNS pointer (PTR) record.
 *------------------------------------------------------------------------------*/

/*--------------------------------------------------------------------------------
 * System Imports
 *------------------------------------------------------------------------------*/
#include "stdafx.h"
using namespace System;
using namespace System::Net;

namespace Adaptive
{
	namespace Network
	{
		namespace Dns
		{
			/// <summary>
			/// Represents a DNS pointer (PTR) record.
			/// </summary>
			public value struct DnsPointerRecord
			{
			internal:
			/// <summary>
			/// Initializes a new instance of the class from the unmanaged record.
			/// </summary>
			/// <param name="record"> A pointer to a DNS_RECORD structure whose contents are to be copied.</param>
			DnsPointerRecord(DNS_RECORD* record)
			{
				if ((record == NULL) ||
					(record->wType != DNS_TYPE_PTR) && 
					(record->wType != DNS_TYPE_NS) &&	
					(record->wType != DNS_TYPE_CNAME) &&
					(record->wType != DNS_TYPE_MB) &&
					(record->wType != DNS_TYPE_MD) && 
					(record->wType != DNS_TYPE_MF) && 
					(record->wType != DNS_TYPE_MG) && 
					(record->wType != DNS_TYPE_MR))
				{
					HostName = String::Empty;
				}
				else
				{
					HostName = gcnew String( record->Data.PTR.pNameHost );
				}
			}
			private:
			/// <summary>
			/// Static constructor.
			/// </summary>
			static DnsPointerRecord()
			{
			}
			public:

			/// <summary>
			/// A string representing the pointer (PTR) record data.
			/// </summary>
			/// <value>
			/// A host name value or an empty string.
			/// </value>
			String^	HostName;
			};
		}
	}
}
